package org.homonoia.model.task;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;

public class Task implements Serializable {

    private static final long serialVersionUID = -7402578762735847806L;

    private String id = null;
    private TaskType taskType = null;

    private int startRow = -1;
    private int endRow = -1;
    private ArrayList<String> searchTerms = null;
    private String table = null;
    private String column = null;

    private ArrayList<TaskResults> taskResults = null;

    public Task(final String id, int startRow, int endRow, final ArrayList<String> searchTerms,
	    final String table, final String column) {
	super();

	this.id = id;
	this.startRow = startRow;
	this.endRow = endRow;
	this.searchTerms = searchTerms;
	this.table = table;
	this.column = column;
	this.taskType = TaskType.SEARCH;
    }

    public Task(final String id, final ArrayList<TaskResults> taskResults) {
	super();

	this.id = id;
	this.taskResults = taskResults;
	this.taskType = TaskType.JOIN;
    }

    public final String getID() {
	return id;
    }

    public TaskType getTaskType() {
	return taskType;
    }

    public final String getTable() {
	return table;
    }

    public final String getColumn() {
	return column;
    }

    public int getStartRow() {
	return startRow;
    }

    public int getEndRow() {
	return endRow;
    }

    public final ArrayList<String> getSearchTerms() {
	return searchTerms;
    }

    public final ArrayList<TaskResults> getTaskResults() {
	return taskResults;
    }

    private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException {
	is.defaultReadObject();
    }

    private void writeObject(ObjectOutputStream os) throws IOException {
	os.defaultWriteObject();
    }

}
